﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;

using Djikstria;
using BaseClasses;

using Daystate.BiDictionary;

namespace DjikstriasAlgorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var graph = GraphBuilder.CreateGraph();

            string startVertexSymbol = Utilities.Configuration[Configuration.ConfigKeys.StartVertexSymbol].GetValue<string>();
            string endVertexSymbol = Utilities.Configuration[Configuration.ConfigKeys.EndVertexSymbol].GetValue<string>();

            Vertex startVertex = graph.Vertexes.First(x => x.Symbol == startVertexSymbol);
            Vertex endVertex = graph.Vertexes.First(x => x.Symbol == endVertexSymbol);

            var shortestPath = ShortestPathAlgorithm.FindShortestPath(startVertex, endVertex, graph);

            Console.WriteLine("The shortest path between {0} and {1}:", startVertex.Symbol, endVertex.Symbol);
            foreach (Vertex v in shortestPath)
            {
                Console.Write(v.Symbol);
                if (v.Symbol != endVertex.Symbol)
                    Console.Write(" -> ");
            }


            Console.ReadKey();
        }
    }
}
